<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
  <style>

    #d1{
      width: 10000px;
      height: 100px;
      background-color: red;
      position: fixed;/*固定定位*/

    }
    #d2{
      width: 50px;
      height: 200px;
      background-color: blue;
      position: fixed;
      /*通过 right left top bottom  偏移  只想相对于窗口
      right: 20px;
      bottom: 50px;
    }
    body{
      margin: 0;/*去掉自带外边距*/
    }



  </style>
</head>
<body>
   <div id="d1"></div>
   <div id="d2"></div>
   <img src="../b.jpg" alt="">
   <img src="../b.jpg" alt="">
   <img src="../b.jpg" alt="">
   <img src="../b.jpg" alt="">
</body>
</html>